class reflect:
    def __init__(self):
        self.name = 'woniuxy'
        # self.age='24'

    def methods(self):
        print('method print for reflect')

#实例化一个类
Instance = reflect()
#如果Instance 对象中有属性name则打印self.name的值，否则打印'not find'
print (getattr(Instance, 'name','not found'))
# 如果Instance 对象中有属性age则打印self.age的值，否则打印'not find'print
print (getattr(Instance, 'age', 'not find'))
# 如果有方法method，打印其地址，否则打印default
print (getattr(Instance, 'methods', 'default'))
# 如果有方法method，运行函数并打印None否则打印default
print (getattr(Instance, 'methods', 'default')())